<?php
include_once("DBCORE.cls.php");	
class db_Chair
{
	private $tablename = "tblchair";
	private $db;
	public function __construct()
	{
		$this->db = new DBCORE();
		$this->db->db_connect('localhost','root','','restaurant');
		$this->db->db_query("SET NAMES 'UTF8");
	}
	public function select($id)
	{
		$id = !empty($id) ?"WHERE RestaurantID = '{$id}'":"";
		$myStrSQL = "SELECT * FROM {$this->tablename} {$id}";
		$data = $this->db->db_fetch_assoc($this->db->db_query($myStrSQL));
		return $data;
	}
	public function selectAll($id)
	{
		$id = !empty($id) ?"WHERE RestaurantID = '{$id}'":"";
		$myStrSQL = "SELECT * FROM {$this->tablename} {$id}";
		$result = $this->db->db_query($myStrSQL);
		$resArr = array();
		while ( $row = $this->db->db_fetch_assoc($result)) {
			$resArr[] = $row;
		}
		return $resArr;
	}
	public function selectChair($id)
	{
		$id = !empty($id) ?"WHERE RestaurantID = '{$id}'":"";
		$myStrSQL = "SELECT * FROM {$this->tablename} {$id}";
		$result = $this->db->db_query($myStrSQL);
		$resArr = array();
		while ( $row = $this->db->db_fetch_assoc($result)) {
			$resArr[] = $row;
		}
		return $resArr;
	}	
}
?>